package classroom.four;

import classroom.Cat;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:周次煜
 * Date: 2024-04-12
 * Time：10:37
 */
public class Animal {
    public  String name;
    public  int age;
    private String color;

    public void talk() {
        System.out.println(this.name+"正在叫！");
    }

    public Animal(String name, int age, String color) {
        this.name = name;
        this.age = age;
        this.color = color;
    }

    @Override
    public String toString() {
        return "Animal{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", color='" + color + '\'' +
                '}';
    }
}

class Cat2 extends Animal {
    public Cat2(String name, int age, String color) {
        super(name, age, color);
    }

    public static void main(String[] args) {
        Cat2 cat=new Cat2("小猫",12,"白色");
        System.out.println(cat);
    }
}
